//默认静态页面路由，替换src/route/frontRoute.ts
import { RouteRecordRaw } from 'vue-router';

/**
 * 路由meta对象参数说明
 * meta: {
 *      title:          菜单栏及 tagsView 栏、菜单搜索名称（国际化）
 *      isLink：        是否超链接菜单，开启外链条件，`1、isLink: 链接地址不为空`
 *      isHide：        是否隐藏此路由
 *      isKeepAlive：   是否缓存组件状态
 *      isAffix：       是否固定在 tagsView 栏上
 *      isIframe：      是否内嵌窗口，开启条件，`1、isIframe:true 2、isLink：链接地址不为空`
 *      roles：         当前路由权限标识，取角色管理。控制路由显示、隐藏。超级管理员：admin 普通角色：common
 *      icon：          菜单、tagsView 图标，阿里：加 `iconfont xxx`，fontawesome：加 `fa xxx`
 * }
 */

/**
 * 定义动态路由
 * 前端添加路由，请在顶级节点的 `children 数组` 里添加
 * @description 未开启 isRequestRoutes 为 true 时使用（前端控制路由），开启时第一个顶级 children 的路由将被替换成接口请求回来的路由数据
 * @returns 返回路由菜单数据
 */
let routes: Array<RouteRecordRaw> = [
	{
		path: '/',
		name: '/',
		component: () => import('@/layout/index.vue'),
		redirect: '/index',
		meta: {
			isKeepAlive: true
		},
		children: [
			{
				path: '/index',
				name: 'index',
				component: () => import('@/views/index.vue'),
				meta: {
					title: '首页',
					isLink: '',
					isHide: false,
					isKeepAlive: false,
					isAffix: false,
					isIframe: false,
					roles: ['admin', 'common'],
					icon: 'diy-icon-homefill'
				}
			},
			{
				path: '/user',
				name: 'user',
				component: () => import('@/views/user.vue'),
				meta: {
					title: '会员管理',
					isLink: '',
					isHide: false,
					isKeepAlive: false,
					isAffix: false,
					isIframe: false,
					roles: ['admin', 'common'],
					icon: 'diy-icon-profilefill'
				}
			},
			{
				path: '/goods',
				name: 'goods',
				component: () => import('@/layout/routerView/parent.vue'),
				redirect: '/goods/goods',
				meta: {
					title: '商品管理',
					isLink: '',
					isHide: false,
					isKeepAlive: true,
					isAffix: false,
					isIframe: false,
					roles: ['admin', 'common'],
					icon: 'diy-icon-goodsnewfill'
				},
				children: [
					{
						path: '/goods/goods',
						name: 'goodsgoods',
						component: () => import('@/views/goods/goods.vue'),
						meta: {
							title: '商品管理',
							isLink: '',
							isHide: false,
							isKeepAlive: false,
							isAffix: false,
							isIframe: false,
							roles: ['admin', 'common'],
							icon: 'diy-icon-goods'
						}
					},
					{
						path: '/goods/cate',
						name: 'goodscate',
						component: () => import('@/views/goods/cate.vue'),
						meta: {
							title: '商品分类',
							isLink: '',
							isHide: false,
							isKeepAlive: false,
							isAffix: false,
							isIframe: false,
							roles: ['admin', 'common'],
							icon: 'diy-icon-cascades'
						}
					}
				]
			},
			{
				path: '/order',
				name: 'order',
				component: () => import('@/layout/routerView/parent.vue'),
				redirect: '/order/index',
				meta: {
					title: '订单管理',
					isLink: '',
					isHide: false,
					isKeepAlive: true,
					isAffix: false,
					isIframe: false,
					roles: ['admin', 'common'],
					icon: 'diy-icon-cartfill'
				},
				children: [
					{
						path: '/order/index',
						name: 'orderindex',
						component: () => import('@/views/order/index.vue'),
						meta: {
							title: '全部订单',
							isLink: '',
							isHide: false,
							isKeepAlive: false,
							isAffix: false,
							isIframe: false,
							roles: ['admin', 'common'],
							icon: 'diy-icon-cart'
						}
					}
				]
			},
			{
				path: '/cms',
				name: 'cms',
				component: () => import('@/layout/routerView/parent.vue'),
				redirect: '/cms/article',
				meta: {
					title: '内容管理',
					isLink: '',
					isHide: false,
					isKeepAlive: true,
					isAffix: false,
					isIframe: false,
					roles: ['admin', 'common'],
					icon: 'diy-icon-newshotfill'
				},
				children: [
					{
						path: '/cms/article',
						name: 'cmsarticle',
						component: () => import('@/views/cms/article.vue'),
						meta: {
							title: '文章管理',
							isLink: '',
							isHide: false,
							isKeepAlive: false,
							isAffix: false,
							isIframe: false,
							roles: ['admin', 'common'],
							icon: 'diy-icon-newshot'
						}
					},
					{
						path: '/cms/cate',
						name: 'cmscate',
						component: () => import('@/views/cms/cate.vue'),
						meta: {
							title: '文章分类',
							isLink: '',
							isHide: false,
							isKeepAlive: false,
							isAffix: false,
							isIframe: false,
							roles: ['admin', 'common'],
							icon: 'diy-icon-cascades'
						}
					},
					{
						path: '/cms/swiper',
						name: 'cmsswiper',
						component: () => import('@/views/cms/swiper.vue'),
						meta: {
							title: '轮播图片',
							isLink: '',
							isHide: false,
							isKeepAlive: false,
							isAffix: false,
							isIframe: false,
							roles: ['admin', 'common'],
							icon: 'diy-icon-pic'
						}
					},
					{
						path: '/cms/notice',
						name: 'cmsnotice',
						component: () => import('@/views/cms/notice.vue'),
						meta: {
							title: '新闻动态',
							isLink: '',
							isHide: false,
							isKeepAlive: false,
							isAffix: false,
							isIframe: false,
							roles: ['admin', 'common'],
							icon: 'diy-icon-comment'
						}
					},
					{
						path: '/cms/helparticle',
						name: 'cmshelparticle',
						component: () => import('@/views/cms/helparticle.vue'),
						meta: {
							title: '帮助管理',
							isLink: '',
							isHide: false,
							isKeepAlive: false,
							isAffix: false,
							isIframe: false,
							roles: ['admin', 'common'],
							icon: 'diy-icon-magic'
						}
					},
					{
						path: '/cms/helpcate',
						name: 'cmshelpcate',
						component: () => import('@/views/cms/helpcate.vue'),
						meta: {
							title: '帮助分类',
							isLink: '',
							isHide: false,
							isKeepAlive: false,
							isAffix: false,
							isIframe: false,
							roles: ['admin', 'common'],
							icon: 'diy-icon-question'
						}
					}
				]
			},
			{
				path: '/setting',
				name: 'setting',
				component: () => import('@/layout/routerView/parent.vue'),
				redirect: '/setting/wechat',
				meta: {
					title: '设置',
					isLink: '',
					isHide: false,
					isKeepAlive: true,
					isAffix: false,
					isIframe: false,
					roles: ['admin', 'common'],
					icon: 'diy-icon-settingsfill'
				},
				children: [
					{
						path: '/setting/wechat',
						name: 'settingwechat',
						component: () => import('@/views/setting/wechat.vue'),
						meta: {
							title: '微信设置',
							isLink: '',
							isHide: false,
							isKeepAlive: false,
							isAffix: false,
							isIframe: false,
							roles: ['admin', 'common'],
							icon: 'diy-icon-wechat'
						}
					},
					{
						path: '/setting/index',
						name: 'settingindex',
						component: () => import('@/views/setting/index.vue'),
						meta: {
							title: '参数设置',
							isLink: '',
							isHide: false,
							isKeepAlive: false,
							isAffix: false,
							isIframe: false,
							roles: ['admin', 'common'],
							icon: 'diy-icon-settings'
						}
					}
				]
			}
		]
	}
];

export const frontRoutes = {
	dynamicRoutes: routes
};
